<?php
/**
*
* @package phpBB3 Social Network
* @author  kmklr72
* @copyright (c) 2009 kmklr72
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

include($phpbb_root_path . 'sn_blocks/misc/misc_constants.' . $phpEx);

$user_id = request_var('u', 0);

// Get block information
$sql = 'SELECT * FROM ' . SN_MISC_BLOCK_TABLE . '
	WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);
$misc = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

$misc['bbcode_options'] = (($misc['enable_bbcode']) ? OPTION_FLAG_BBCODE : 0) +
	(($misc['enable_smilies']) ? OPTION_FLAG_SMILIES : 0) + 
	(($misc['enable_magic_url']) ? OPTION_FLAG_LINKS : 0);

$text = generate_text_for_display($misc['profile_info_block'], $misc['bbcode_uid'], $misc['bbcode_bitfield'], $misc['bbcode_options']);
$text_edit = generate_text_for_edit($misc['profile_info_block'], $misc['bbcode_uid'], $misc['bbcode_options']);

$text_empty = (empty($misc['profile_info_block'])) ? 1 : 0;

// Assign the template vars
$template->assign_vars(array(
	'MISC_TEXT'				=> $text,
	'MISC_TEXT_EDIT'		=> $text_edit['text'],

	'S_IS_OWNER'			=> ($user_id == $user->data['user_id']) ? true : false,
	'S_MISC_FORM_ACTION'	=> append_sid("{$phpbb_root_path}sn_blocks/misc/update_misc.$phpEx", 'u='.$user_id.'&amp;text='.$text_empty),
));

?>